package com.jianqiao.information.comment.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jianqiao.information.comment.domain.CommentEntity;
import com.jianqiao.information.comment.mapper.CommentMapper;
import com.jianqiao.information.comment.service.CommentService;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * author: cyx
 * create: 2024/7/16 11:24
 **/
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper , CommentEntity> implements CommentService {

    @Autowired
    private CommentMapper commentMapper;


    @Override
    public int addComment(CommentEntity commentEntity) {
        Date date = new Date();
        commentEntity.setCreateTime(date);
        if (StringUtils.isNull(commentEntity.getPid())){
            commentEntity.setPid("0");
        }
        int insertCount = commentMapper.insert(commentEntity);
        return insertCount;
    }
}
